package com.atguigu.springcloud.callback;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate.ReturnCallback;

//通过实现 ReturnCallback 接口，启动消息失败返回，比如路由不到队列时触发回调
public class RabbitMQReturnCallback implements ReturnCallback {

	private static final Logger log = LoggerFactory.getLogger(RabbitMQReturnCallback.class.getSimpleName());

	@Override
	public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {	
		
		log.error("收到RabbitMQReturnCallback回调");
		log.error("message->" + message);
		log.error("replyCode->" + replyCode);
		log.error("exchange->" + exchange);
		log.error("routingKey->" + routingKey);
	}
}
